package com.zys.el.user.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zys.el.core.service.impl.CrudServiceImpl;
import com.zys.el.user.po.TimeInfo;
import com.zys.el.user.service.ITimeInfoService;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


@Service
public class TimeInfoServiceImpl extends CrudServiceImpl<TimeInfo> implements ITimeInfoService {
    /**
     * 通过简介和发布时间进行检查是否存在
     *
     * @param item
     * @param date
     * @return 存在返回true 不存在返回false
     */
    @Override
    public boolean IsHaveInfo(String item, Date date) {
        QueryWrapper<TimeInfo> wq = new QueryWrapper<>();
        wq.eq("item_", item);
        wq.eq("public_time_", date);
        List<TimeInfo> list = this.list(wq);
//        System.out.println(list);
        if (list == null || list.size() == 0) {
            return false;
        } else {
            return true;
        }

    }
}
